home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / SASC_6.0_Disk_4.adf / Compiler_Headers / Include / graphics / gels.h < prev    next >
C/C++ Source or Header  |  1992-07-30  |  9KB  |  271 lines

  1. #ifndef    GRAPHICS_GELS_H
  2. #define    GRAPHICS_GELS_H
  3. /*
  4. **    $Filename: graphics/gels.h $
  5. **    $Release: 2.04 Includes, V37.4 $
  6. **    $Revision: 37.0 $
  7. **    $Date: 91/01/07 $
  8. **
  9. **    include file for AMIGA GELS (Graphics Elements)
  10. **
  11. **    (C) Copyright 1985-1991 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. /* VSprite flags */
  20. /* user-set VSprite flags: */
  21. #define SUSERFLAGS  0x00FF    /* mask of all user-settable VSprite-flags */
  22. #define VSPRITE     0x0001    /* set if VSprite, clear if Bob */
  23. #define SAVEBACK    0x0002    /* set if background is to be saved/restored */
  24. #define OVERLAY     0x0004    /* set to mask image of Bob onto background */
  25. #define MUSTDRAW    0x0008    /* set if VSprite absolutely must be drawn */
  26. /* system-set VSprite flags: */
  27. #define BACKSAVED   0x0100    /* this Bob's background has been saved */
  28. #define BOBUPDATE   0x0200    /* temporary flag, useless to outside world */
  29. #define GELGONE     0x0400    /* set if gel is completely clipped (offscreen) */
  30. #define VSOVERFLOW  0x0800    /* VSprite overflow (if MUSTDRAW set we draw!) */
  31.  
  32. /* Bob flags */
  33. /* these are the user flag bits */
  34. #define BUSERFLAGS  0x00FF    /* mask of all user-settable Bob-flags */
  35. #define SAVEBOB     0x0001    /* set to not erase Bob */
  36. #define BOBISCOMP   0x0002    /* set to identify Bob as AnimComp */
  37. /* these are the system flag bits */
  38. #define BWAITING    0x0100    /* set while Bob is waiting on 'after' */
  39. #define BDRAWN        0x0200    /* set when Bob is drawn this DrawG pass*/
  40. #define BOBSAWAY    0x0400    /* set to initiate removal of Bob */
  41. #define BOBNIX        0x0800    /* set when Bob is completely removed */
  42. #define SAVEPRESERVE 0x1000   /* for back-restore during double-buffer*/
  43. #define OUTSTEP     0x2000    /* for double-clearing if double-buffer */
  44.  
  45. /* defines for the animation procedures */
  46. #define ANFRACSIZE  6
  47. #define ANIMHALF    0x0020
  48. #define RINGTRIGGER 0x0001
  49.  
  50.  
  51. /* UserStuff definitions
  52.  *  the user can define these to be a single variable or a sub-structure
  53.  *  if undefined by the user, the system turns these into innocuous variables
  54.  *  see the manual for a thorough definition of the UserStuff definitions
  55.  *
  56.  */
  57. #ifndef VUserStuff          /* VSprite user stuff */
  58. #define VUserStuff WORD
  59. #endif
  60.  
  61. #ifndef BUserStuff          /* Bob user stuff */
  62. #define BUserStuff WORD
  63. #endif
  64.  
  65. #ifndef AUserStuff          /* AnimOb user stuff */
  66. #define AUserStuff WORD
  67. #endif
  68.  
  69.  
  70.  
  71.  
  72. /*********************** GEL STRUCTURES ***********************************/
  73.  
  74. struct VSprite
  75. {
  76. /* --------------------- SYSTEM VARIABLES ------------------------------- */
  77. /* GEL linked list forward/backward pointers sorted by y,x value */
  78.     struct VSprite   *NextVSprite;
  79.     struct VSprite   *PrevVSprite;
  80.  
  81. /* GEL draw list constructed in the order the Bobs are actually drawn, then
  82.  *  list is copied to clear list
  83.  *  must be here in VSprite for system boundary detection
  84.  */
  85.     struct VSprite   *DrawPath;     /* pointer of overlay drawing */
  86.     struct VSprite   *ClearPath;    /* pointer for overlay clearing */
  87.  
  88. /* the VSprite positions are defined in (y,x) order to make sorting
  89.  *  sorting easier, since (y,x) as a long integer
  90.  */
  91.     WORD OldY, OldX;          /* previous position */
  92.  
  93. /* --------------------- COMMON VARIABLES --------------------------------- */
  94.     WORD Flags;          /* VSprite flags */
  95.  
  96.  
  97. /* --------------------- USER VARIABLES ----------------------------------- */
  98. /* the VSprite positions are defined in (y,x) order to make sorting
  99.  *  sorting easier, since (y,x) as a long integer
  100.  */
  101.     WORD Y, X;              /* screen position */
  102.  
  103.     WORD Height;
  104.     WORD Width;          /* number of words per row of image data */
  105.     WORD Depth;          /* number of planes of data */
  106.  
  107.     WORD MeMask;          /* which types can collide with this VSprite*/
  108.     WORD HitMask;          /* which types this VSprite can collide with*/
  109.  
  110.     WORD *ImageData;          /* pointer to VSprite image */
  111.  
  112. /* borderLine is the one-dimensional logical OR of all
  113.  *  the VSprite bits, used for fast collision detection of edge
  114.  */
  115.     WORD *BorderLine;          /* logical OR of all VSprite bits */
  116.     WORD *CollMask;          /* similar to above except this is a matrix */
  117.  
  118. /* pointer to this VSprite's color definitions (not used by Bobs) */
  119.     WORD *SprColors;
  120.  
  121.     struct Bob *VSBob;          /* points home if this VSprite is part of
  122.                    a Bob */
  123.  
  124. /* planePick flag:  set bit selects a plane from image, clear bit selects
  125.  *  use of shadow mask for that plane
  126.  * OnOff flag: if using shadow mask to fill plane, this bit (corresponding
  127.  *  to bit in planePick) describes whether to fill with 0's or 1's
  128.  * There are two uses for these flags:
  129.  *    - if this is the VSprite of a Bob, these flags describe how the Bob
  130.  *      is to be drawn into memory
  131.  *    - if this is a simple VSprite and the user intends on setting the
  132.  *      MUSTDRAW flag of the VSprite, these flags must be set too to describe
  133.  *      which color registers the user wants for the image
  134.  */
  135.     BYTE PlanePick;
  136.     BYTE PlaneOnOff;
  137.  
  138.     VUserStuff VUserExt;      /* user definable:  see note above */
  139. };
  140.  
  141. struct Bob
  142. /* blitter-objects */
  143. {
  144. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  145.  
  146. /* --------------------- COMMON VARIABLES --------------------------------- */
  147.     WORD Flags;    /* general purpose flags (see definitions below) */
  148.  
  149. /* --------------------- USER VARIABLES ----------------------------------- */
  150.     WORD *SaveBuffer;    /* pointer to the buffer for background save */
  151.  
  152. /* used by Bobs for "cookie-cutting" and multi-plane masking */
  153.     WORD *ImageShadow;
  154.  
  155. /* pointer to BOBs for sequenced drawing of Bobs
  156.  *  for correct overlaying of multiple component animations
  157.  */
  158.     struct Bob *Before; /* draw this Bob before Bob pointed to by before */
  159.     struct Bob *After;    /* draw this Bob after Bob pointed to by after */
  160.  
  161.     struct VSprite   *BobVSprite;   /* this Bob's VSprite definition */
  162.  
  163.     struct AnimComp  *BobComp;        /* pointer to this Bob's AnimComp def */
  164.  
  165.     struct DBufPacket *DBuffer;     /* pointer to this Bob's dBuf packet */
  166.  
  167.     BUserStuff BUserExt;        /* Bob user extension */
  168. };
  169.  
  170. struct AnimComp
  171. {
  172. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  173.  
  174. /* --------------------- COMMON VARIABLES --------------------------------- */
  175.     WORD Flags;            /* AnimComp flags for system & user */
  176.  
  177. /* timer defines how long to keep this component active:
  178.  *  if set non-zero, timer decrements to zero then switches to nextSeq
  179.  *  if set to zero, AnimComp never switches
  180.  */
  181.     WORD Timer;
  182.  
  183. /* --------------------- USER VARIABLES ----------------------------------- */
  184. /* initial value for timer when the AnimComp is activated by the system */
  185.     WORD TimeSet;
  186.  
  187. /* pointer to next and previous components of animation object */
  188.     struct AnimComp  *NextComp;
  189.     struct AnimComp  *PrevComp;
  190.  
  191. /* pointer to component component definition of next image in sequence */
  192.     struct AnimComp  *NextSeq;
  193.     struct AnimComp  *PrevSeq;
  194.  
  195.     WORD (*AnimCRoutine)(); /* address of special animation procedure */
  196.  
  197.     WORD YTrans;     /* initial y translation (if this is a component) */
  198.     WORD XTrans;     /* initial x translation (if this is a component) */
  199.  
  200.     struct AnimOb    *HeadOb;
  201.  
  202.     struct Bob         *AnimBob;
  203. };
  204.  
  205. struct AnimOb
  206. {
  207. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  208.     struct AnimOb    *NextOb, *PrevOb;
  209.  
  210. /* number of calls to Animate this AnimOb has endured */
  211.     LONG Clock;
  212.  
  213.     WORD AnOldY, AnOldX;        /* old y,x coordinates */
  214.  
  215. /* --------------------- COMMON VARIABLES --------------------------------- */
  216.     WORD AnY, AnX;            /* y,x coordinates of the AnimOb */
  217.  
  218. /* --------------------- USER VARIABLES ----------------------------------- */
  219.     WORD YVel, XVel;            /* velocities of this object */
  220.     WORD YAccel, XAccel;        /* accelerations of this object */
  221.  
  222.     WORD RingYTrans, RingXTrans;    /* ring translation values */
  223.  
  224.     WORD (*AnimORoutine)();        /* address of special animation
  225.                        procedure */
  226.  
  227.     struct AnimComp  *HeadComp;     /* pointer to first component */
  228.  
  229.     AUserStuff AUserExt;        /* AnimOb user extension */
  230. };
  231.  
  232. /* dBufPacket defines the values needed to be saved across buffer to buffer
  233.  *  when in double-buffer mode
  234.  */
  235. struct DBufPacket
  236. {
  237.     WORD BufY, BufX;            /* save the other buffers screen coordinates */
  238.     struct VSprite   *BufPath;        /* carry the draw path over the gap */
  239.  
  240. /* these pointers must be filled in by the user */
  241. /* pointer to other buffer's background save buffer */
  242.     WORD *BufBuffer;
  243. };
  244.  
  245.  
  246.  
  247. /* ************************************************************************ */
  248.  
  249. /* these are GEL functions that are currently simple enough to exist as a
  250.  *  definition.  It should not be assumed that this will always be the case
  251.  */
  252. #define InitAnimate(animKey) {*(animKey) = NULL;}
  253. #define RemBob(b) {(b)->Flags |= BOBSAWAY;}
  254.  
  255.  
  256. /* ************************************************************************ */
  257.  
  258. #define B2NORM        0
  259. #define B2SWAP        1
  260. #define B2BOBBER    2
  261.  
  262. /* ************************************************************************ */
  263.  
  264. /* a structure to contain the 16 collision procedure addresses */
  265. struct collTable
  266. {
  267.     int (*collPtrs[16])();
  268. };
  269.  
  270. #endif    /* GRAPHICS_GELS_H */
  271.